﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

/// <summary>
/// SHA加密
/// </summary>
/// <author>邓晨露</author>
namespace Common.Utility
{
    public class SHAEncrypt
    {
        public static string SHA256(string str)
        {
            byte[] bytes;
            SHA256 sha256 = new SHA256Managed();
            bytes = sha256.ComputeHash(new UTF8Encoding().GetBytes(str));
            bytes = sha256.Hash;
            sha256.Clear();
            return BitConverter.ToString(bytes).Replace("-", "").ToLower();
        }
    }
}
